var obj = {
  p1: 123,
  p2: 456
};

console.log(Object.getOwnPropertyNames(obj)) //获取key

console.log(Object.keys(obj)) //获取key

console.log(Object.values(obj)) //获取value



// 变量解析
let [a, b] = [1, 3];
let [c, d] = [a, b];
console.log(a, b, c, d) //1 3 1 3

let [foo] = []; //undefined
let [foo] = [
  []
] //[]
let [a, [b], d] = [1, [2, 3], 4]; //1 2 4
let [a, [...b], d] = [1, [2, 3], 4]; //1 [2,3] 4
let [x = 1] = [NaN]; //NaN  
function f() {
  console.log('aaa');
}

let [x = f()] = [undefined]; //执行f() 


let obj = {
  a: "zlt",
  b: 'zcc'
}
let {
  a,
  b
} = obj;
//a=zlt b=zcc

const cart = {
  _wheels: 4,

  get wheels() {
    return this._wheels + "个轮子";
  },

  set wheels(value) {
    if (value < this._wheels) {
      throw new Error('数值太小了！');
    }
    this._wheels = value;
  }
}

console.log(cart.wheels)


let person = {
  name: '张三',
  age: 38,
  children: {
    name: '张小三'
  }
}

let childrenName = person.children && person.childre.name;
console.log(childrenName)


let { ant: { layout: { content}}} = { ant: { layout: { content: "1" } } };
console.log(content)

//引用类型 复制类型


{
  let a = { num: 123 };
  let c = a;
  c.num = 90;
  console.log('a : ', a );
  console.log('c: ', c);
}
{
  let a = { num: 123 };
  let c = JSON.parse(JSON.stringify(a));
  c.num = 90;
  console.log('a : ', a );
  console.log('c: ', c);
}
{
  let a = { a: 1 }
  let c = a.a;
  a.a = 10;
  console.log('c: ', c);
}